<?php

namespace common\models\bx;

use Yii;

/**
 * This is the model class for table "bx_info".
 *
 * @property int $id
 * @property string $title 标题
 * @property string $cover 封面图片
 * @property string $content 内容
 * @property string $company 公司名称
 * @property int $price 价格，单位分
 * @property int $is_top 是否置顶
 * @property int $status 状态：0-删除，1-待审，2-正常
 * @property string $link 链接地址
 * @property int $updated_at
 * @property int $created_at
 */
class BxInfo extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'bx_info';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('bx_db');
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['content', 'status'], 'required'],
            [['content'], 'string'],
            [['price', 'is_top', 'status', 'updated_at', 'created_at'], 'integer'],
            [['title', 'cover', 'company', 'link'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => 'Title',
            'cover' => 'Cover',
            'content' => 'Content',
            'company' => 'Company',
            'price' => 'Price',
            'is_top' => 'Is Top',
            'status' => 'Status',
            'link' => 'Link',
            'updated_at' => 'Updated At',
            'created_at' => 'Created At',
        ];
    }
}
